how to solve using vertical method